package com.ticket.service.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

import com.ticket.service.auth.security.SecurityUtils;

/**
 * 权限验证启动类
 * 
 * @author Ablert
 *
 */
@EnableDiscoveryClient
@SpringBootApplication
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
// @EnableResourceServer
// @SessionAttributes("authorizationRequest")
public class AuthApplication {

	@Bean(name = "auditorAware")
	public AuditorAware<String> auditorAware() {
		return () -> SecurityUtils.getCurrentUserUsername();
	}

	public static void main(String[] args) {
		SpringApplication.run(AuthApplication.class, args);
	}
}
